#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char s[200200];
char c[200200];
int len1;
int len2;
int nt[200200];
void getnt()
{
	int i = 0;
	int t = -1;
	nt[0]= -1;
	while(i<len2)
	{
		if(t==-1||c[i]==c[t])
		{
			i++;
			t++;
			nt[i]=t;
		}
		else t = nt[t];
	}
}
int kmp()
{
	int i = 0;
	int j = 0;
	while(i<len1)
	{
		if(j==-1||s[i]==c[j])
		{
			i++;
			j++;
		}
		else j = nt[j];
		if(j==len2)
		{
			return 1;
		}
	}
	return 0;
}
int main()
{
	while(scanf("%s %s",s,c)!=EOF)
	{
		int len = strlen(s);
		len2 = strlen(c);
		if(len<len2) printf("no\n");
		else
		{
			strcat(s,s);
			//puts(s);
			len1 = 2*len;
			getnt();
			int ans = kmp();
			if(ans)
			{
				printf("yes\n");
			}
			else printf("no\n");
		}
	}
}
